<?php

namespace app\validate;

use share\validate\SceneValidate;

class UserValidate extends SceneValidate{
    protected $rule = [
        'state' => 'require|min:16',
        'encode' => 'require|min:30',
        'userId' => 'require|min:30',
        'token' => 'require|min:30',
        'identityId' => 'min:30',
        'email' => 'email|max:128',
        'phone' => 'max:20',
        'serverSite' => 'max:20',
        'location' => 'max:30',
        'picture' => 'min:10',
        'sex' => 'number|>=:0|<=:3',
        'nickName' => 'max:30',    
        'account' => 'require|max:64',
        'userAccount' => 'require|max:64',
        'changeAccount' => 'require|max:64',  
        'accessToken' => 'alphaNum|max:128',
        'vendor' => 'require',
        'language' => 'require',
        'deleteTime' => 'require|number|>=:168000',
        'oldPassword' => 'require|min:6|max:64',
        'newPassword' => 'require|min:6|max:64',
        'self' => 'require|number',
        'password' => 'require|min:6',
        'loginType' => 'require|max:64',
        'code'  => 'require',
        'appId'  => 'require',
        'openId'  => 'length:1,120',
        'qrcode' =>  'require|alphaNum|length:16,32',
        'name' => 'require|length:6,54',
        'captcha' => 'require|length:4,8',
        'hash' => 'require|length:32,64',
        'refer' => 'require|length:12,128',
    ];    

    protected $scene = [
        'changeAccountCode' => ['userAccount','changeAccount','accessToken','vendor','language','state','encode'],
        'changeAccount' => ['userAccount','changeAccount','accessToken','verifyCode','vendor','language','state','encode'],
        'update' => ['userId','token','identityId','email','phone','serverSite','location','picture','sex','nickName','state','encode'],
        'delete' => ['userId','token','deleteTime','email','state','encode'],
        'changePswd' => ['userId','token','oldPassword','newPassword','state','encode'],
        'searchAccount' => ['userId','token','account','nickName','state','encode'],
        'accountBaseInfo' => ['userId','token','account','vendor','state','encode'],
        'sendDevicePassword' => ['isoCode','email','phone','accessToken','self','password','userId','token'],
        'sendDevicePasswordV2' => ['language','email','phone','accessToken','self','password','packageName','userId','token'],

        'bindByCode' => ['loginType','code','openId','userId','token','state','encode'],
        'unbind' => ['loginType','userId','token','state','encode'],
        'getBindState' => ['userId','token','state','encode'],
        'authorizeQrcode' => ['userId','token','state','encode','qrcode'],

        'delByPswd' => ['name','password','captcha','refer','hash'],

    ];
}